package com.example.shop_2210.adapter

import android.graphics.Paint
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.Goods
import com.example.shop_2210.R
import com.example.shop_2210.utils.GlideUtils

class GoodsHomeAdapter:BaseQuickAdapter<Goods,BaseViewHolder>(R.layout.item_goods_home) {
    override fun convert(holder: BaseViewHolder, item: Goods) {
        GlideUtils.loadImage(context,item.image,holder.getView(R.id.goods_pic))
        holder.setText(R.id.goods_name,item.storeName)
        holder.setText(R.id.goods_price,"促销价:${item.price}")
        holder.setText(R.id.goods_otPrice,"原价:${item.otPrice}")
        //原价下划线
        val otPrice = holder.getView<TextView>(R.id.goods_otPrice)
        otPrice.paintFlags = Paint.STRIKE_THRU_TEXT_FLAG
    }
}